<!--  -->
<template>
   <view>
	  <component :is="cur"></component>
      <view class="footer">
		  <view v-for="(item,key) in items" @click="changeItem(item.index)" :key="key" class="item">
			<img :src="item.icon" alt="">
			  <view :class="item.className">{{item.text}}</view>
		  </view>
		  
	  </view>
   </view>
</template>

<script>
import basics from "../pages/basics/Home";
import components from "../pages/component/Home";
import plugins from "../pages/plugin/Home";
export default {
  data() {
    return {
      cur: "basics"
    };
  },
  components: {
    basics,
    components,
    plugins
  },
  computed: {
    items() {
      return [
        {
          text: "元素",
          index: "basics",
          icon:
            this.cur == "basics"
              ? require("../../static/tabbar/basics_cur.png")
              : require("../../static/tabbar/basics.png"),
          className: this.cur == "basics" ? "text-green" : ""
        },
        {
          text: "组件",
          index: "components",
          icon:
            this.cur == "components"
              ? require("../../static/tabbar/component_cur.png")
              : require("../../static/tabbar/component.png"),
          className: this.cur == "components" ? "text-green" : ""
        },
        {
          text: "扩展",
          index: "plugins",
          icon:
            this.cur == "plugins"
              ? require("../../static/tabbar/plugin_cur.png")
              : require("../../static/tabbar/plugin.png"),
          className: this.cur == "plugins" ? "text-green" : ""
        }
      ];
    }
  },
  methods: {
    changeItem(item) {
      this.cur = item;
    }
  }
};
</script>
<style lang='scss'>
@function px2rem($px, $base-font-size: 75px) {
  @if (unitless($px)) {
    @warn "Assuming #{$px} to be in pixels, attempting to convert it into pixels for you";
    @return px2rem($px + 0px); // That may fail.
  } @else if (unit($px) == rem) {
    @return $px;
  }
  @return ($px / $base-font-size) * 1rem;
}
.main {
  position: relative;

  width: inherit;
  height: inherit;
  z-index:-99999999;
  background-color: #F1F1F1;
}
.main img {
  width: 100%;
}
.nav {
  padding: 0 0.68rem;
  width: 100vw;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  flex-wrap: wrap;
  justify-content: space-around;
  grid-gap: 0.4rem;
  margin-bottom: 1.866667rem;
  .nav-li {
    width: 100%;
    height: 2.526667rem;
    background-position: left bottom;
    background-size: cover;
    border-radius: 0.2rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
    justify-items: center;
    font-size: 0.37rem;
    // box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 0;
    &::after {
      position: absolute;
      content: "";
      width: 100%;
      height: 100%;
      position: absolute;
      left: 0;
      bottom: - px2rem(18px);
      background-color: inherit;
      border-radius: 20px;
      transform: scale(0.9);
      opacity: 0.3;
      z-index: -1;
    }
    .nav-title {
      justify-self: start;
      padding-left: px2rem(25px);
    }
    i.navIcon {
      font-size: 0.723333rem;
      padding-right: px2rem(25px);
      justify-self: end;
    }
    .nav-name {
      text-transform: capitalize;
      justify-self: start;
      padding-left: px2rem(25px);
      position: relative;
      grid-row-start: 2;
      grid-row-end: 3;
      grid-column-start: 1;
      grid-column-end: 3;
      width: 100%;
      height: 100%;
      &::before,
      &::after {
        position: absolute;
        content: "";
        background-color:white;
       
        // border:1px solid white;
      }
      &::before {
        right: px2rem(40px);
        top: px2rem(38px);
        width: 40%;
        height: px2rem(3px);
        opacity: 0.2;
      }
      &::after {
        width: px2rem(40px);
        height: px2rem(5px);
        right: px2rem(40px);
        top: px2rem(36px);
        opacity: 0.5;
      }
    }
    .nav-name::first-letter {
      font-size: 30px;
      text-shadow: 2px 2px 0px white;
    }
    .nav-line {
      height: 100%;
      width: 100%;
      position: relative;
      display: flex;
      align-items: flex-end;
      padding-bottom: px2rem(26px);
      &::before {
        position: absolute;
        content: "";
        left: - px2rem(6px);
        width: px2rem(100px);
        height: px2rem(2px);
        background-color: white;
        box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6);
        // opacity: 0.3;
      }
      &::after {
        position: absolute;
        content: "";
        width: px2rem(40px);
        height: px2rem(6px);
        background-color: white;
        box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6);
        right: px2rem(40px);
        opacity: 0.6;
      }
    }
    color: white;
    span:nth-child(1) {
      &::first-letter {
        color: white;
        font-size: 0.45rem;
      }
    }
  }
}

@keyframes show {
  0% {
    transform: translateY(-100px);
  }

  60% {
    transform: translateY(40px);
  }

  100% {
    transform: translateY(0px);
  }
}

@-webkit-keyframes show {
  0% {
    transform: translateY(-100px);
  }

  60% {
    transform: translateY(40px);
  }

  100% {
    transform: translateY(0px);
  }
}
</style>
